/**
 * 版权所有 2009-2015 中国中医科学院中医药信息研究所 何前锋 frontpeak@yahoo.com.cn
 **/
package cn.ac.cintcm.sh.domain;

import java.util.HashMap;
import java.util.List;

import cn.ac.cintcm.sh.dao.HerbDao;


public class Herbs {
 
	private static HashMap<String, HerbEntry> herbEntry;
    
    private static HerbDao herbDao = new HerbDao();

    public static HerbEntry getHerb(String name) {
        if (herbEntry==null) {
            List<HerbEntry> herbEntries = herbDao.getHerbs();
            herbEntry = new HashMap<String, HerbEntry>();
            for (HerbEntry he : herbEntries) {
                herbEntry.put(he.getName(), he);
            }
        }
        
        return herbEntry.get(name);
    }
	 
}